/**
 * 
 */
package de.cbf.cam.dsa.model.entities.states;

import de.cbf.cam.dsa.model.ModelBase;
import de.cbf.cam.dsa.model.base.BaseWeapon;
import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.entities.constants.TalentConstants;
import de.cbf.cam.dsa.model.entities.weapon.OneWeapon;
import de.cbf.cam.dsa.model.entities.weapon.WeaponInUse;

/**
 * @author Nebelritter
 *
 */
public class StateLimbUnusable extends OneState{
	/**
	 * @uml.property  name="limb"
	 */
	private String limb;

	public StateLimbUnusable(String limb) {
		super();
		this.limb = limb;
	}

	@Override
	public void resolveOnCharacter(BattleChar character) {
		character.getCharacter().setWeapon(null, limb);
	}

	@Override
	public void restoreOnCharacter(BattleChar character) {
		BaseWeapon unarmed = ModelBase.getInstance().getVirginWeapon(BaseWeapon.UNARMED);
		if (unarmed instanceof OneWeapon) {
			OneWeapon weaponUnarmed = (OneWeapon) unarmed;
			WeaponInUse unarmedInUse = weaponUnarmed.useIt(character.getCharacter(),TalentConstants.Raufen);
			character.getCharacter().setWeapon(unarmedInUse, limb);			
		}
	}	
}
